/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package datas;

import Beans.WatchList;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**

 @author jtanguay
 */
public interface WatchListMapper {

  final String SELECT_FAVORITE_FOR_USER = "Select * FROM watchlist WHERE idUser=#{idUser}";
  final String INSERT_FAVORITE = "INSERT INTO watchlist (idUser,idWatchedUser,isOnWhiteList) Values (#{idUser},#{idWatchedUser},#{isOnWhiteList})";
  final String DELETE_FAVORITE = "DELETE FROM watchlist WHERE idUser=#{idUser} And idWatchedUser=#{idWatchedUser}";

  @Select(SELECT_FAVORITE_FOR_USER)
  List<WatchList> getFavoriteForUser(int idUser);

  @Insert(INSERT_FAVORITE)
  int insertFavorite(@Param("idUser") int idUser, @Param("idWatchedUser") int idWatchedUser, @Param("isOnWhiteList") boolean isOnWhiteList);

  @Delete(DELETE_FAVORITE)
  int deleteWatchList(@Param("idUser") int idUser, @Param("idWatchedUser") int idWatchedUser);
}
